import HttpClient, { HttpClientConfig } from 'axios-mapper';
import networkConfig from '@/config/net.config';
import { getToken } from '@/utils/cookies';

const https = (hasToken = true): HttpClient => {
  const config: HttpClientConfig = {
    baseURL: networkConfig.host,
    headers: {
      'OC-Token': hasToken ? getToken() : '',
    },
  };
  return new HttpClient(config);
};

export default https;
